//
//  LHBaseTableViewController.m
//  OCSinaWeibo
//
//  Created by LiHong on 15/10/27.
//  Copyright © 2015年 LiHong. All rights reserved.
//

#import "LHBaseTableViewController.h"
#import "LHVistorView.h"
#import "LHHomeTableViewController.h"
#import "LHMsgTableViewController.h"
#import "LHDiscoverTableViewController.h"
#import "LHProfileTableViewController.h"
#import "LHOAuthViewController.h"
#import "LHAccount.h"
@interface LHBaseTableViewController()<LHVistorViewDelegate>

@end

@implementation LHBaseTableViewController

- (void)loadView{
    LHAccount *account = [LHAccount shareAccount];
    account.isLogin ? [self setupVistorView] : [super loadView];
//    [super loadView];
}
//- (void)viewDidLoad{
//    _userLogin ? [super viewDidLoad] : [self setupVistorView];
//}

//- (void)setUserLogin:(BOOL)userLogin{
//    _userLogin = userLogin;
//    if (!userLogin) {
//        [self setupVistorView];
//    }
//    
//}
- (void)setupVistorView{
    LHVistorView *vistorView = [[LHVistorView alloc]init];
    vistorView.delegate = self;
    self.view = vistorView;
    
    if ([self isKindOfClass:[LHHomeTableViewController class]]) {
        [vistorView startRotation];
    }else if ([self isKindOfClass:[LHMsgTableViewController class]]){
        [vistorView setupInfoWithMessage:@"登录后，别人评论你的微博，发给你的消息，都会在这里收到通知" imageName:@"visitordiscover_image_message"];
    }else if ([self isKindOfClass:[LHDiscoverTableViewController class]]){
        [vistorView setupInfoWithMessage:@"登录后，最新、最热微博尽在掌握，不再会与实事潮流擦肩而过" imageName:@"visitordiscover_image_message"];
    }else if ([self isKindOfClass:[LHProfileTableViewController class]]){
        [vistorView setupInfoWithMessage:@"登录后，你的微博、相册、个人资料会显示在这里，展示给别人" imageName:@"visitordiscover_image_profile"];
    }
    
    
    
}

#pragma mark - LHVistorViewDelegate代理方法
/// 登录
- (void)vistorViewWillLogin{
    NSLog(@"vistorViewWillLogin");
    UIViewController *OAuthVc = [[LHOAuthViewController alloc]init];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:OAuthVc];
    [self presentViewController:nav animated:YES completion:nil];
}
/// 注册
- (void)vistorViewWillRegister{
    NSLog(@"vistorViewWillRegister");
}
@end
